package dbsync4j.core.loader.crawler;

import schemacrawler.schema.IndexSortSequence;
import dbsync4j.core.behavior.DatabaseObject;
import dbsync4j.core.loader.behavior.DatabaseLoader;
import dbsync4j.core.types.SortSequence;

public class CrawlerIndexSortTypeLoader implements DatabaseLoader<SortSequence> {

	@Override
	public SortSequence loadDatabaseObject(Object schemaObject) {

		IndexSortSequence crawlerIndexSortSequence = 
			(IndexSortSequence) schemaObject;
		
		SortSequence sortSequence = null;
		
		if(crawlerIndexSortSequence.getCode().equals(SortSequence.ascending.getCode())) {
			sortSequence = SortSequence.ascending;
		}

		if(crawlerIndexSortSequence.getCode().equals(SortSequence.descending.getCode())) {
			sortSequence = SortSequence.descending;
		}

		if(crawlerIndexSortSequence.getCode().equals(SortSequence.unknown.getCode())) {
			sortSequence = SortSequence.unknown;
		}		
		
		return sortSequence;
	}

	@Override
	public void setDependantObjectOwner(DatabaseObject databaseObject) {
		
	}

}
